package components.dialogs
{
	import SEApp.dialogs.se_alert;
	
	import UIFree.uif_component;
	import UIFree.uif_ecomponent;
	
	import classes.clt_events;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;

	public class clt_alertInvite extends se_alert {
		private var _banners		: uif_ecomponent;
		private var _bannerClass	: Class;
		public function clt_alertInvite(parent:uif_component, message:String,
										bannerClass: Class,
										closeFunc:Function=null, 
										cancelButton:Boolean=false) {
			_bannerClass = bannerClass;
			super(parent, message, closeFunc, cancelButton, 620, 380);
			title.text = app.classes.locale.ALERTTITLE;
			var inner: Rectangle = getInner();
			var invButton: Object = new app.classes['button'](this, inner.x + inner.width - 130, okButton.y, 130, okButton.height, 'button')
			invButton.text = app.classes.locale.INVITEBUTTONCAPTION;
			invButton.addEvent(MouseEvent.CLICK, function(e: Event): void {
				app.dispatchEvent(new Event(clt_events.INVITEDIALOGSHOW));
			});
		}
		
		override protected function createDialogComponents():void {
			super.createDialogComponents();
			if (_bannerClass) {
				var inner: Rectangle = getInner();
				_banners = new _bannerClass(this, inner.x, inner.y, inner.width, inner.height);	
			}
		}
		
		override protected function resizeFromText(): Rectangle {
			if (_banners) _desc.y = _banners.y + _banners.height + getSpace(true);
			return super.resizeFromText();
		}
	}
}